Modular Event-Driven Processing

ABSTRACT

Each of a plurality of thread boundaries comprises functionality to be performed for a given event by a single thread. A plurality of queues through which events may be routed may be coupled to the thread boundaries. A plurality of tasks may be configured in a defined relationship, each task being associated with a thread boundary and comprising a unit of code for performing a specific function. Resources may be allocated to thread boundaries based on queue depth.

CROSS-REFERENCES TO RELATED APPLICATIONS

This application is a continuation application claiming priority from pending U.S. application Ser. No. 11/205,263, filed Aug. 15, 2005, entitled “MODULAR EVENT DRIVEN PROCESSING”, which claims priority from co-pending U.S. Provisional Patent Application No. 60/602,539, filed Aug. 17, 2004, entitled “TECHNIQUES FOR DELIVERING PERSONALIZED CONTENT WITH A REAL-TIME ROUTING NETWORK, MODULAR EVENT-DRIVEN ARCHITECTURE, MODULAR EVENT-DRIVEN PROCESSING AND VIEWER FAILOVER TESTING A SYSTEM MEMORY WHILE AN OPERATING SYSTEM IS ACTIVE”, which are hereby incorporated by reference, as if set forth in full in this document, for all purposes.

BACKGROUND

Embodiments of the present disclosure relate generally to high performance computing and to providing computing services in a modular, event driven manner.

A computing device may have a limited number of resources in which to process requests. In order to efficiently process the requests, the device may need to manage how the resources may be allocated to which requests. When a resource is assigned to a request, that request may be processed. Devices may see large increases in requests for certain reasons. For example, a server serving web pages for a web site to many users may receive a large number of requests for web pages from users. The users may see delays if resources are not assigned to request in an efficient manner.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating a high-level overview of a system according to one embodiment.

FIG. 2 is a block diagram illustrating an example of four tasks capable of encrypting and sending outgoing messages according to one embodiment.

FIG. 3 is a flowchart illustrating steps for processing a high level description of tasks and the relationship between them according to one embodiment.

FIG. 4 is a block diagram illustrating a high-level overview of an administrative module according to one embodiment.

The figures depict some embodiments for purposes of illustration only. One skilled in the art will readily recognize from the following discussion that alternative embodiments of the structures and methods illustrated herein may be employed.

A further understanding of the nature and the advantages of the disclosure disclosed herein may be realized by reference of the remaining portions of the specification and the attached drawings.

DETAILED DESCRIPTION

In one embodiment, modular event driven processing provides a plurality of thread boundaries, each thread boundary comprising functionality to be performed for a given event by a single thread. A plurality of queues may be communicatively coupled to the thread boundaries, such that thread boundaries may be connected by queues through which events may be routed. The division of the computational functionality into thread boundaries enables identification of those portions that may be sensitive to load, because their corresponding queues may fill. Computational resources such as threads may then be dynamically allocated to thread boundaries based on queue depth.

A plurality of tasks may be in a defined relationship to provide a service, where each task may be associated with a thread boundary and includes a unit of code for performing a specific function. A plurality of service utilities may also provided, where each service utility includes a utility that may be accessible by multiple tasks.

In some embodiments, the tasks and the defined relationship between them may be described at a high level externally to the system itself, and capable of according to that high level description. In some embodiments, this high-level description may be in a declarative language, such as Extensible Markup Language (XML). This high-level external description enables dynamic configuration of the tasks and the relationship between them, as well as for authentication thereof.

FIG. 1 illustrates a high-level overview of a system 101 according to one embodiment. System 101 may be provided in any computing device that processes information. For example, system 101 may be included in a server or router.

System 101 provides some functionality (e.g., a service). The functionality may be divided into a plurality of thread boundaries 103, where each thread boundary 103 may encapsulate a portion of the application logic for the desired functionality. The thread boundaries may be connected by thread boundary queues 105. Events 107 (e.g., requests for service, messages) may be input to and output from thread boundaries 103 via thread boundary queues 105.

An event may be any processing that may be required. One example of an event 107 may be a request by a remote client for a service. For example, the client may request to log in, in which case system 101 (e.g., a server) would need to check the client's credentials and then take appropriate action. According to some embodiments, system 101 may handle this request by encapsulating it as an event 107 and passing it though a chain of thread boundaries 103, each of which may be capable of performing a small piece of the service, ultimately outputting either a verification or denial of the log in. Various other examples of events will be apparent to those of ordinary skill in the art in light of this specification, e.g., events may include processing a request for a record from a database, processing of an incoming e-mail message, handling outgoing encoded data, sending an outgoing error message, processing requests for web pages, etc.

A computing system such as a server may need to handle a large number of events simultaneously. Therefore, events 107 between thread boundaries 103 may reside in thread boundary queues 105. Within a thread boundary 103, a single thread may handle an event 107. However, once a first thread boundary 103 completes its processing for an event 107 and places the event 107 in a queue 105, another thread may pick up the event 107 and move it through the next thread boundary 103.

FIG. 1 depicts two thread boundaries 103, but any number of thread boundaries may be provided. Many computing systems provide complex functionality, which can be divided into many thread boundaries 103 as desired. The division of functionality into thread boundaries 103, as well as the number of thread boundaries 103 to use, may differ. Many variations will be apparent to those of ordinary skill in the relevant art in light of this specification.

The division of the functionality into thread boundaries 103 enables identification of those portions that may be sensitive to load, because their corresponding thread boundary queues 105 may fill. In some embodiments, a resource allocation module 109 monitors the thread boundary queues 105, and allocates computational resources to the corresponding thread boundaries 103 based on queue depth. For example, a number of events being held in a first queue 105 and a second queue 105 may be determined. Resources may be allocated based on the number of events being held in first queue 105 and second queue 105, respectively. For example, if first queue 105 is longer than second queue 105, more resources may be allocated to first thread boundary 103. Accordingly, the load of a thread boundary 103 may be used to determine how to dynamically allocate resources. Although queue length is described, it will be understood that other techniques of determining the load may be used, such as using a number of events being processed by a thread boundary 103. In the embodiment illustrated in FIG. 1, the resource allocation module 109 may be centralized, and therefore separate from the application logic encapsulated by the thread boundaries 103 and queues 105.

In some embodiments, the resource allocation module 109 assigns threads from a thread pool 111 to thread boundaries 103 according to the length of their inbound queues 105, or according to other metrics as desired. As will be understood by those of ordinary skill in the relevant art, each event 107 may be handled by a single thread (or multiple threads) within a thread boundary 103. Multiple events 107 can be processed through the same boundary 103 in parallel, and such parallel event 107 processing can be performed by multiple threads (no more than one per event 107 in one embodiment) as desired.

Thus, portions of the system 101 that might otherwise become bottlenecks may receive more resources, thereby smoothing out application flow and improving performance. Since the allocation may be dynamic, the resource allocation module 109 can respond to varying conditions. If the system 101 receives a flood of a certain type of requests, for example, a portion that may not normally a bottleneck may become overloaded. Under such circumstances, the resource allocation module 109 can react accordingly, by dynamically altering computational resource allocation.

This provides advantages because the division of processing into thread boundaries may not involve allocating a single request to one thread, which then performs all processing for the request. Each request may not be treated as being the same in terms of the resources it may require. System 101 may tune itself to load that builds at thread boundaries where events may queue. Thus, the internal performance of system 101 may be monitored and may be tuned in response to load.

Also, system 101 may use queue length of queues for thread boundaries to determine where to allocate resources. This allows system 101 to determine where to allocate resources without introducing complex functionality on how to prioritize events.

It may be understood that although the resource allocation module 109 may be illustrated as a single entity, as the term may be used herein a resource allocation module 109 refers to a collection of functionalities that may be implemented as software, hardware, firmware or any combination of the three. Where the resource allocation module 109 may be implemented as software, it can be implemented as a standalone program, but may also be implemented in other ways, for example as part of a larger program, as a plurality of separate programs, or as one or more statically or dynamically linked libraries.

As illustrated in FIG. 1, the functionality encapsulated by each thread boundary 103 may be performed by one or more tasks 113. As the term may be used herein, a task 113 may include any block of code for performing a specific function. Multiple tasks 113 can be included in a chain to provide desired computational services.

FIG. 2 illustrates a simple example of four tasks 113 capable of encrypting and sending messages. An input message 201 to be encrypted and transmitted may be received by Task 1, which checks the validity of the destination address. If the destination address is valid, Task 3 encrypts the input message 201, and Task 4 sends the encrypted message 203 as output to the destination address. On the other hand, if the destination address is invalid, Task 2 creates an appropriate error message which Task 4 sends as an output message 203 to the origin address. The functionality provided by the four tasks may be part of a much larger computing system, as desired.

Returning to FIG. 1, tasks 113 may be at a finer level of granularity than thread boundaries 103. Multiple tasks 113 can be encapsulated within a single thread boundary 103, although it may also be possible for a thread boundary 103 to contain only a single task 113. Specific tasks 113 may be allocated to specific thread boundaries 103. For example, FIG. 1 shows tasks 1 and 2 as being encapsulated within thread boundary 1, and tasks 3-5 as being encapsulated within thread boundary 2. In other embodiments, tasks 1-5 may be divided between more than two thread boundaries 103, or all five tasks may be encapsulated within a single thread boundary as desired. There may be many possibilities for allocating tasks 113 to thread boundaries according to various embodiments. As will be apparent to those of ordinary skill in the relevant art in light of this specification, the relationship between tasks 113 and thread boundaries 103 can be set and modified by configuration changes, as desired.

As illustrated in FIG. 1, all desired functionality may not be performed by tasks 113. For example, certain functionality may be performed by service utilities 115, which may be utilities that may be used by multiple tasks 113. In addition to creating efficiency by centralizing standard utilities, service utilities 115 add another layer of flexibility. In embodiments in which tasks 113 access service utilities 115 through an interface, it may be possible to swap implementations of a service 115 without altering any of the tasks 113 that rely on it. For example, if many tasks 113 are required to write to a log file, a logging service may be provided. Tasks 113 may access the logging service through service utilities 115. Services 115 may store state and thus may be used be multiple tasks 113 for an event.

Service utilities 115 can be used as the originating sources for events 107. For example, when a client issues a request, a network protocol service 115 may be responsible for packaging the request as an event 107, and inserting it into the appropriate thread boundary queue 105, so as to enter the request into the task flow. Whereas events 107 may be created by service utilities 115 and passed to tasks 113 for processing, tasks typically modify existing events 107, and forward them to other tasks 113.

In some embodiments, service utilities 115 can store state, whereas tasks 113 may be stateless. A list of currently registered users, for example, would typically be controlled by a service 115. A task 113 may access the list by calling a method on the service 115. Although tasks 113 are described as being stateless, tasks 113 may store state in some embodiments.

In one embodiment, tasks 113 may not create threads or have any knowledge about what threads may be controlling internal task 113 procedures. Service utilities 115, on the other hand, may be thread-safe, since they may be accessed by multiple tasks 113 running in different thread boundaries 103. Thus, service utilities 115 may be accessed by multiple threads.

When to utilize a task 113 and when to use a service 115 may vary. In some embodiments, tasks may be used as much as possible. In such embodiments, a service 115 may be used for a utility that cuts across many tasks 113, a component that originates events 107, or a component that manages state. In other embodiments tasks 113 and/or service utilities 115 may be used for more or fewer purposes as desired. It will be apparent to those of ordinary skill in the relevant art in light of this specification that the terms “task” and “service” may be merely used herein to describe various functionalities. This particular naming for these functionalities may not be mandatory or significant, and the mechanisms that implement various embodiments and/or its features may have different names, divisions and/or formats.

As explained above, a plurality of tasks 113 may be in a defined relationship so as to provide desired functionality for a service. The defined relationship between tasks 113 may depend upon the functionality to be provided. For example, tasks 113 may be arranged differently depending on the functionality desired. As explained above, tasks 113 may receive events 107 as input, perform operations thereon, and pass the (possibly transformed) events 107 on to other tasks 113 for further processing. A task 113 can make decisions as to how to process an event 107 and/or where to pass it, based on its contents or other factors.

Specific tasks 113 may be capable of receiving specific input, executing specific processing, and sending specific output. A task 113 may be processing code, with zero or more inputs (in other words, sources from which the task receives data in the form of events 107) and zero of more outputs, through which the task 113 sends events 107 after processing. The input, processing and output associated with a task 113 can be thought of as defining contracts for the task 113. A source contract specifies constraints on events 107 received via the task's 113 input. A sink contract describes the changes the task 113 makes to events 107 that pass through it. The terms “input,” “output,” “source contract,” and “sink contract” are linguistic terms, used herein to describe the underlying functionality. Other names to be used to describe such aspects and functionality may be contemplated.

To illustrate an example of a source contract and a sink contract, a client may request authentication of a user, by transmitting an event 107 (i.e. an authentication request) to the system 101 (e.g., a server). For sake of example, suppose the event 107 contains a string called “username,” a string called “password.” This event 107 may be passed to a validator task 113 whose source contract specifies that it receives a string called “password” and a string called “username.” The task 113 may use these strings to authenticate the user. The authentication result may be passed on to various tasks 113 downstream and the validator task's 113 sink contract may specify that a Boolean called “valid” be added to the event 107. In other cases, a task's 113 sink contract might remove items from an event 107.

In some embodiments, the tasks 113 and the defined relationship between them may be described at a high level externally to the system itself, and configured according to the high level description. In some embodiments, this high-level description is in a declarative language, such as Extensible Markup Language (XML). The high-level description can be stored, for example in an XML configuration file.

This high-level external description enables dynamic configuration of the tasks 113 and the relationship between them, as well as for authentication thereof. As will be readily apparent to those of ordinary skill in the relevant art in light of this specification, the high level description of the tasks 113 and the defined relationship between them may include a description of the task's 113 functionality, inputs and outputs, source contracts and sink contracts, as well as the way in which the plurality of tasks 113 may be related together to provide the desired functionality, and the assignment of tasks 113 to thread boundaries 103. In some embodiments, more or less information may be included in the high-level description.

FIG. 3 illustrates steps for processing a high-level description of the tasks 113 and the relationship between them according to one embodiment. In step 301, the system 101 reads the high level description (e.g. from an XML configuration file). In step 303, system 101 dynamically configures the plurality of tasks accordingly.

Dynamic modifications to tasks 113 and/or the relationship between tasks 113 may be made by making corresponding modifications to the high level description. In step 305, the system 101 may dynamically modify a task 113, responsive to a corresponding modification of the high level description. Additionally, in steps 307 and 309, the system 101 may dynamically modify the defined relationship between the plurality of tasks 113, or the assignment of tasks 113 to thread boundaries 103, responsive to a corresponding modification of the high level description.

In step 311, the high level description may also be used to automatically determine whether the defined relationship between the tasks 113 may be logically consistent. Such determination, may, for example, include verification of source and sink contracts.

FIG. 4 illustrates a high level overview of an administrative module 401 according to one embodiment. As illustrated in FIG. 4, in some embodiments, tasks 113, service utilities 115 and or thread boundaries 103 may be implemented such that these components may be monitored and controlled via the administrative module 401. In such embodiments, tasks 113 and/or other components may be communicatively coupled to the administrative module 401, and attributes (e.g., the number of active connections) of these tasks 113 or other components can be monitored or dynamically modified from the administrative module 401, for example via a graphical user interface 405 or command line 407, or where appropriate a configuration file.

In one such embodiment, the above-described communication between the components and the administrative module 401 may be performed via the Java Management Extension's (JMX) MBean interfaces. In such embodiments, tasks 113, service utilities 115 and/or thread boundaries 103 may be implementations of an MBean, and thus automatically include an MBean interface exposed to the administrative module 401, which in such embodiments may be built on top of JMX.

JMX separates administration, management, and monitoring of components from the components themselves. This allows the administration front-end of an application to be swappable. As an example, a computing system such as a server could include an administrative module 401 packaged with both a web based graphical user interface 405 and a command line interface 407 for monitoring and controlling components. These interfaces 405, 407 can be developed independently using the rules and interfaces defined by JMX, in a manner that will be apparent to those of ordinary skill in the art in light of this specification. These interfaces 405, 407 can subsequently be used to monitor and dynamically configure tasks 113, service utilities 115 and/or thread boundaries 103, in a manner that will also be apparent to those of ordinary skill in the art in light of this specification. Of course, other embodiments may be implemented in development environments other than JMX, as desired.

As will be understood by one skilled in the art, the disclosure may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. Likewise, the particular naming and division of the modules, features, attributes, methodologies and other aspects may not be mandatory or significant, and the mechanisms that implement embodiments or its features may have different names, divisions and/or formats. Furthermore, as will be apparent to one of ordinary skill in the art, the modules, features, attributes, methodologies and other aspects of the disclosure can be implemented as software, hardware, firmware or any combination of the three. Wherever a component may be implemented as software, the component may be implemented as a standalone program, as part of a larger program, as a plurality of separate programs, as a statically or dynamically linked library, as a kernel loadable module, as a device driver, and/or in every and any other way known now or in the future to those of skill in the art of computer programming. Additionally, embodiments may be in no way limited to implementation in any specific programming language, or for any specific operating system or environment. Accordingly, the disclosure is intended to be illustrative, but not limiting, of the scope of the disclosure, which is set forth in the following claims.

In one embodiment, the term “and/or” may indicate that any combination of elements connected by “and/or” may be used. For example, two words or expressions in a phrase using “and/or” may mean one or the other or both. In one embodiment, the term “substantially” may mean being largely but not wholly that which may be specified, or all that may be specified. In one embodiment, the term capable of may mean configured, adapted, able, etc. For example, the term capable of performing an action may mean an element may be able to perform the action, may be configured to perform the action and/or may be adapted to perform the action.

Embodiments can be implemented in the form of control logic in software or hardware or a combination of both. The control logic may be stored in an information storage medium as a plurality of instructions adapted to direct an information processing device to perform a set of steps disclosed in one embodiment. Based on the disclosure and teachings provided herein, a person of ordinary skill in the art will appreciate other ways and/or methods to implement the embodiments.

The above description is illustrative but not restrictive. Many variations of the disclosure will become apparent to those skilled in the art upon review of the disclosure. The scope of the disclosure should, therefore, be determined not with reference to the above description, but instead should be determined with reference to the pending claims along with their full scope or equivalents. 

1. A computer system for processing events, the computer system comprising: a plurality of thread boundaries, wherein the plurality of thread boundaries are capable of performing a service, wherein a first thread boundary in the plurality of thread boundaries includes at least one task capable of performing at least a part of the service; a plurality of thread boundary queues coupled to the respective thread boundaries, wherein the first thread boundary includes a first thread boundary queue capable of holding one or more events for routing to the first thread boundary; a resource allocation module capable of allocating one or more resources to the first thread boundary based on a first thread boundary queue depth of the first thread boundary queue, wherein the first thread boundary queue depth is based on a number of events being held in the first thread boundary queue; an administrative module adapted for controlling the operation of the plurality of thread boundaries and tasks included within each of the thread boundaries.
 2. The computer system of claim 1, wherein the administrative module is adapted for modifying defined relationships comprising communicative couplings between the tasks.
 3. The computer system of claim 1, further including one or more service utilities, each of which is communicatively coupled to a thread boundary and is adapted for performing at least a part of the service performed by the thread boundary.
 4. The computer system of claim 3, wherein at least one of the service utilities is communicatively coupled to a task and is capable of performing at least a part of the service performed by the task.
 5. The computer system of claim 4, wherein the at least one of the service utilities is capable of initiating an event held at a thread boundary for processing.
 6. The computer system of claim 3, wherein the at least one of the service utilities is communicatively coupled to multiple thread boundaries.
 7. The computer system of claim 1, wherein the at least one task of the first thread boundary modifies a first event held in the first thread boundary queue for processing and then forwards the modified first event to a different task for additional processing.
 8. A computer method for processing events, the computer method comprising: processing a high level description of an event processing system that specifies communicative couplings relating to a plurality of thread boundaries, wherein the plurality of thread boundaries are capable of performing a service, wherein each of the thread boundaries includes at least one task capable of performing at least a part of the service performed by the respective thread boundary, a plurality of thread boundary queues coupled to the respective thread boundaries, wherein the each thread boundary queue is capable of holding one or more events for routing to the thread boundary to which the thread boundary is coupled, a resource allocation module capable of allocating one or more resources to the respective thread boundaries based on thread boundary queue depth of each respective thread boundary queue, wherein the thread boundary queue depth is based on a number of events being held in the thread boundary queue; configuring the at least one task of each thread boundary in accordance with the high level description; receiving a modification to the high level description; dynamically modifying the task configuration in accordance with the received modification.
 9. The computer method of claim 8, wherein dynamically modifying comprises modifying the performance of the task.
 10. The computer method of claim 8, wherein dynamically modifying comprises modifying defined relationships between the tasks included in a thread boundary.
 11. The computer method of claim 10 further including: determining whether the modified defined relationships between tasks of the thread boundary is logically consistent.
 12. The computer method of claim 8, wherein dynamically modifying comprises modifying at least communicative coupling between tasks associated with at least one of the thread boundaries. 